# Auther：wujehy
# email:wujehy@qq.com
# @File : MQTTClient.py 
# @Time : 19-3-27 下午8:39
import json

import paho.mqtt.client as mqtt

class MQTTClient():
    def __init__(self):
        return

HOST = "iotgeek.top"
PORT = 1883
if __name__=="__main__":
    """
    这是　mtqq 上传的测试ＡＰＩ
    
    测试端口
    
    内容是　下面data 部分补全
    
    效果展示　目前部署在　http://iotgeek.top:8080/Test1
    """
    client = mqtt.Client()
    client.connect(HOST, PORT, 60)
    devid = "/devices/578aea14857ee64bba27e823e9d93dac/data"
    msgs={
        "devices":"578aea14857ee64bba27e823e9d93dac",
        "type":"ender",
        "data":{
            "wendu":34,
            "shidu":55
        }

    }
    out=json.dumps(msgs)
    print(out)
    client.publish(devid, out, 2)
    client.loop_forever()